<template>
  <el-config-provider :locale="locale">
    <router-view :changeLang="changeLang" />
  </el-config-provider>
</template>

<script setup>
import useSettingsStore from '@/store/modules/settings'
import { handleThemeStyle } from '@/utils/theme'
import { ElConfigProvider } from 'element-plus'

// 国际化 测试
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import en from 'element-plus/es/locale/lang/en'
import ru from 'element-plus/es/locale/lang/ru'

onMounted(() => { // ruo
  nextTick(() => {
    // 初始化主题样式
    handleThemeStyle(useSettingsStore().theme)
  })
  // 添加F12事件监听器
  // window.addEventListener('keydown', handleKeyDown);  //step1
})
// onBeforeUnmount(() => {
//   // 移除F12事件监听器
//   window.removeEventListener('keydown', handleKeyDown); //step2
// })

// function handleKeyDown (event) {
//   console.log(event)
//   if (event.key === 'F12' || (event.ctrlKey && event.shiftKey && event.key === 'I')) {
//     event.preventDefault();
//     alert('F12 is disabled !');
//   }
// }


// 切换中英俄文
let locale = ref()
const changeLang = function (val) {
  let langs = { zhCn, en, ru }
  locale.value = langs[val]
}




</script>
<style scoped></style>
